package com.aggregate.pay.transfar;

import com.aggregate.pay.transfar.bean.BalanceQueryData;
import com.aggregate.pay.transfar.bean.BalanceQueryResult;
import com.aggregate.pay.transfar.bean.Pay2BankData;
import com.aggregate.pay.transfar.bean.Pay2BankResult;
import com.aggregate.pay.transfar.bean.PayQueryData;
import com.aggregate.pay.transfar.bean.PayQueryResult;
import com.aggregate.pay.transfar.support.Client;
import com.aggregate.pay.transfar.support.Config;
import com.aggregate.pay.transfar.support.Factory;
import com.aggregate.pay.transfar.support.HttpClient;
import com.aggregate.pay.transfar.support.Merch;
import com.aggregate.pay.transfar.support.client.BalanceQuery;
import com.aggregate.pay.transfar.support.client.Pay2Bank;
import com.aggregate.pay.transfar.support.client.PayQuery;

/**
 * 传化支付接口工具类，相关配置和接口调用从此类开始
 * @author Moyq5
 * @date 2018年10月24日
 */
public abstract class TransfarApiFactory {

	public static void config(Config config, HttpClient httpClient) {
		Factory.setConfig(config);
		Factory.setHttpClient(httpClient);
	}

	@SuppressWarnings("unchecked")
	public static Client<Pay2BankData, Pay2BankResult> pay2BankClient(Merch merch) {
		return (Client<Pay2BankData, Pay2BankResult>)Factory.getClient(Pay2Bank.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<PayQueryData, PayQueryResult> payQueryClient(Merch merch) {
		return (Client<PayQueryData, PayQueryResult>)Factory.getClient(PayQuery.class, merch);
	}

	@SuppressWarnings("unchecked")
	public static Client<BalanceQueryData, BalanceQueryResult> balanceQueryClient(Merch merch) {
		return (Client<BalanceQueryData, BalanceQueryResult>)Factory.getClient(BalanceQuery.class, merch);
	}

}
